package cn.dankal.lequ.ui.customview;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

import cn.dankal.lequ.R;

/**
 * 作者： fred on 16/4/16 15:36.
 * 邮箱：fred_kang@dankal.cn
 */
public class RegisterPoint extends View {
    Paint paint;
    int color;
    int r,y;

    public RegisterPoint(Context context, AttributeSet attrs) {
        super(context, attrs);
        TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.Point);
        this.color = ta.getColor(R.styleable.Point_mycolor, Color.parseColor("#d6d6d6"));
        ta.recycle();
    }

    @Override
    protected void onDraw(Canvas canvas) {
        paint = new Paint();
        paint.setAntiAlias(true);
        paint.setColor(color);
        y=getWidth()/2;
        r = getHeight() / 2;
        canvas.drawCircle(r, r, r, paint);
        super.onDraw(canvas);
    }


    public void setColor(int color) {
        this.color = color;
        postInvalidate();
    }
}
